package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.util.List;

@TableName("t_car")
public class CarBean {
    /**
     * 购物车id
     */
    @TableId(value = "pk_carId",type = IdType.AUTO)
    private Integer id;
    @TableField("fk_productId")
    private Integer productId;
    /**
     * 商品对象
     */
    @TableField(exist = false)
    private ProductBean productBean;
    /**
     * 用户编号
     */
    @TableField("fk_userId")
    private Integer userId;
    /**
     * 商品数量
     */
    @TableField("c_num")
    private int num =1;

    public CarBean() {
    }

    public CarBean(Integer productId, Integer userId) {
        this.productId = productId;
        this.userId = userId;
        this.num = num;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public void setProductBean(ProductBean productBean) {
        this.productBean = productBean;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public Integer getId() {
        return id;
    }

    public ProductBean getProductBean() {
        return productBean;
    }

    public Integer getUserId() {
        return userId;
    }

    public int getNum() {
        return num;
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    @Override
    public String toString() {
        return "CarBean{" +
                "id=" + id +
                ", productId=" + productId +
                ", productBean=" + productBean +
                ", userId=" + userId +
                ", num=" + num +
                '}';
    }
}
